#Include <array.au3>

Global $avCtrlList[1] = [0]

$Title ="无标题 - Notepad2"
$Text =""
WinWaitActive($Title)
$ClassNames = _WinGetClassNameList($Title, $Text)
$avClassList = StringSplit($ClassNames, @LF)

; create a table for Class and text
Global $showList[$avClassList[0]-1][2]

For $i = 1 To $avClassList[0]-1
	$showList[$i-1][0]=$avClassList[$i]
	$showList[$i-1][1]=ControlGetText($Title,$Text,$avClassList[$i])
Next

; display class list
_ArrayDisplay($showList, "Windows Class List")

Func _WinGetClassNameList($sWinTitle = "", $sWinText = "")
    Local $c, $NN, $hCtrl
    Local $sClassList = WinGetClassList($sWinTitle, $sWinText)
    If @error Then Return SetError(1, 0, 0)
    Local $avClassList = StringSplit($sClassList, @LF)
    $sClassList = ""
    For $c = 1 To $avClassList[0]
        $NN = 1
        While 1
            $hCtrl = ControlGetHandle($sWinTitle, $sWinText, $avClassList[$c] & $NN)
            If @error Then
                ExitLoop
            Else
                $sClassList &= $avClassList[$c] & $NN & @LF
                $NN += 1
            EndIf
        WEnd
    Next
    Return $sClassList
EndFunc